<?php

class pl_viethanController extends stadmincontroller {

    public function __construct($config) {
        parent::__construct($config);
    }

    protected function addSubMenu() {
        parent::addSubMenu();
        add_submenu_page($this->config ['theme_name'], 'SlopeTracker Menus', 'Theme Menus', 'edit_theme_options', 'nav-menus.php');
    }

    public function loadCss() { // load more css custom here
        echo '<link type="text/css" rel="stylesheet" href="' . $this->config['cssUrl'] . 'prettyphoto/prettyPhoto.css">';
    }

    public function loadScript() { // load more js custom here
        echo '<script type="text/javascript" src="' . $this->config ['scriptUrl'] . 'jquery.prettyPhoto.js"></script>';
        echo '<script type="text/javascript" src="' . $this->config ['scriptUrl'] . 'tiny_mce/tiny_mce.js"></script>';
    }

    public function activationTheme() {
        
    }

     public function index() {

        $option = $this->option;
        //initialize variable to view
        $this->view->option = $option;
        $this->view->headIcon = 'icon_re';
        $this->view->headTitle1 = 'Home Settings';

        if ($_POST['data']) {
            $data = $_POST['data'];
            $data['contact_footer_vi'] = str_replace(array("\\'",'\\"'),array("'",'"'),$data['contact_footer_vi']);
            $data['contact_footer_en'] = str_replace(array("\\'",'\\"'),array("'",'"'),$data['contact_footer_en']);
            if ($this->updateOption($data)) {
                $arg = array(
                    'status' => 'success',
                    'message' => __('Update option successful', $config['theme_name'])
                );
                echo json_encode($arg);
                die;
            } else {
                $arg = array(
                    'status' => 'error',
                    'message' => __('Update option unsuccessful', $config['theme_name'])
                );
                echo json_encode($arg);
                die;
            }
        }
    }

}

?>